#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Mikan Action Module

Mikan Python Web Framework
"""

__author__ = "K.Sonohara"
__status__ = "develop"
__version__ = "0.0.0_36"
__date__    = "2014/01/05"
__license__ = 'LGPL'

# ------------------------------------------------------------
## Import Section
# ------------------------------------------------------------
# Python

# ESiPC
from esipc import ESiPCProperty

# Mikan
from mikan.core import AbstractMikanPerform
from mikan.request import AbstractMikanRequest

# ------------------------------------------------------------
## Variable Section
# ------------------------------------------------------------

# ------------------------------------------------------------
## Function Section
# ------------------------------------------------------------

# ------------------------------------------------------------
## Class Section
# ------------------------------------------------------------

# ------------------------------------------------------------
## Mikan Abstract Action Class
#
class AbstractMikanAction(AbstractMikanPerform):

	def __init__(self, parent):
		# param is request or parent ?
		r = None
		p = None
		if (isinstance(parent, AbstractMikanRequest)):
			r = parent
		else:
			r = parent.request
			p = parent

		# super
		super(AbstractMikanAction, self).__init__(r)

		# parent is action
		self.FParent = p
		if (p != None):
			if (isinstance(p, AbstractMikanAction)):
				if (p.performs != None):
					p.performs.append(self)

	def get_parent(self):
		return self.FParent

	def prepare(self):
		if not super(AbstractMikanAction, self).prepare():
			return False

		return self.request.ispostmethod

	# ----------------------------------------------------
	## Property
	parent = ESiPCProperty(get_parent, None, None)

# ------------------------------------------------------------
## Mikan No Action Class
#
class MikanNoAction(AbstractMikanPerform):

	def __init__(self, parent):
		super(MikanNoAction, self).__init__(parent)

# ------------------------------------------------------------
## Main Section
# ------------------------------------------------------------
if __name__ == '__main__':
	pass

# ------------------------------------------------------------
